--夜战皇城活动
--#include "data\config\activityconfig\DailyActivity\NightFightingCfg.lua" once
--#include "data\functions\Activity\DailyActivity\NightFighting.lua" once
local npcId = 105
NpcDialog[npcId] = {}
local t = NpcDialog[npcId]

t.main = function(sysarg)
	local levelLimit = NightFightingCfg.level[1]
	local strColor1 = Lang.ScriptTips.Color_Greed
	if not Actor.checkActorLevel( sysarg, NightFightingCfg.level[1], NightFightingCfg.level[2] ) then
		strColor1 = Lang.ScriptTips.Color_Red
	end

	local strCond1 = string.format( Lang.ScriptTips.LevelLimitFormat, strColor1, levelLimit )
	local strCond  = strCond1
	-----------------
	local strDesc 		= ""
	local okBtn 		= ""			--{按钮;样式;按钮名;函数名;描述}
	local strBtnList 	= ""
	local sceneId 		= Actor.getSceneId( sysarg )

	strDesc 	=  Lang.ScriptTips.ActivityGuide001
	okBtn 		= "{btn;0;"..Lang.ScriptTips.ButtonEnter..";%s;}"			--{按钮;样式;按钮名;函数名;描述}
	strBtnList 	= string.format(okBtn, "Enter")

	------------------
	

	--local localFun = string.format("OpenView,%s,%d", enLinkBuyItemWnd, cfg.itemId)
	--strBtnList = strBtnList .. string.format(cfg.buyBtn, localFun)

	-----------------
	local pack = DataPack.allocPacket(sysarg, LogicCmd.npcDialogSys.sysID, LogicCmd.npcDialogSys.sub.sNpcDlgData)
	
	DataPack.writeUint64(pack, Actor.getNpc(sysarg))
	DataPack.writeByte(pack, NpcDialogType.GeneralNpcDlg)
	DataPack.writeString(pack, strCond)
	DataPack.writeString(pack, strDesc)
	DataPack.writeString(pack, strBtnList)
	DataPack.writeChar(pack, -1)
	DataPack.writeByte(pack, 0);
	DataPack.flush(pack)

	return str
end

--进入活动场景
t.Enter = function ( sysarg )
	--等级检测
	if(Actor.checkActorLevel(sysarg, NightFightingCfg.level[1], NightFightingCfg.level[2])~=true)then
		return Actor.sendTipmsg( sysarg, string.format(Lang.ScriptTips.ActivityGuide002,NightFightingCfg.level[1]), ttFlyTip )
	end

	local sysVar = System.getDyanmicVar()
	
	if sysVar.NightFightingStartFlag == nil then	
		return Actor.sendTipmsg( sysarg, Lang.ScriptTips.ActivityGuide003, ttFlyTip )
	end	
	
	NightFightingEnterScene(sysarg)
end


